package call4paper;

import java.util.Calendar;
import java.util.Vector;

import exception.DoesNotUploadPaperJobException;

import accesory.DeadLine;


import website.User;

public class RevisionState extends CFPState {
	private DeadLine date = new DeadLine(Calendar.DATE + 17,Calendar.MONTH , Calendar.YEAR);

	@Override
	public boolean checkDeadLine() {
		return date.isToday();
	}

	@Override
	public void setFinalStatusState(Vector<PaperJob> paperJobs) {
		for(PaperJob paperJob: paperJobs){
			paperJob.setStatus("parcial revized");
		}
	}

	@Override
	public CFPState nextStates() {
		return new ClosedState();
	}

	@Override
	public void uploadPaperJob(PaperJob aJob, CFP aCFP) throws DoesNotUploadPaperJobException {
		throw new DoesNotUploadPaperJobException();		
	}

	/**
	 * retorna solo los trabajos asociado al usuario como revisor.
	 */
	@Override
	public Vector<PaperJob> checkAsignationCFP(CFP aCFP, User user) {
		Vector<PaperJob> paper = new Vector<PaperJob>();
		for(PaperJob p: aCFP.getPaperJobs()){
			if(p.getReviewer().contains(user))
				paper.add(p);
		}
		return paper;
	}

}
